package br.com.vti.sisp_sicrim.antigo.controller.relatorios;

import java.io.FileNotFoundException;
import java.text.ParseException;

import net.sf.jasperreports.engine.JRException;
import br.com.caelum.vraptor.Result;
import br.com.vti.sisp_sicrim.antigo.model.DidCadastro;
import br.com.vti.sisp_sicrim.antigo.util.Relatorios;
import br.com.vti.sisp_sicrim.antigo.util.Sessao;

/**
 * Classe responsavel por encapsular o tratamento e as consistencias da tela Idcpb004Report
 * 
 * @author Incode - Data: mai/2014
 * 
 */
public class Idcpb004Report {
	private String diaideNomide; // DB
	private Long dinideRegger; // DB
	private String horaCorrente;
	private Result result;
	private Sessao sessao;
	private Relatorios report;
	// Classes views
	DidCadastro vwDidcad = new DidCadastro();

	// Classes includes

	public Idcpb004Report() throws JRException {
		inicializar();
	}

	public Idcpb004Report(Sessao sessao) throws JRException {
		this.sessao = sessao;
		inicializar();
	}

	public void inicializar() throws JRException {
		report = new Relatorios();
		report.setNumeroRel(1, "D");
		{
			report.setNumeroLinhaRel(1, 2);
			{
				report.adicionaCampo(1, 13, "dinideRegger", "N", "", "");
				report.adicionaCampo(1, 60, "diaideNomide", "X", "", "");
				report.setFimLinhaRel();
			}
		}
	}

	public boolean validar() {
		// validar os campos recebidos da tela
		return true;
	}

	public void setPageSize(int pagesize) throws JRException {
		report.setPageSize(pagesize);
	}

	public void setLineSize(int linesize) {
		report.setLineSize(linesize);
	}

	public int getPageSize() {
		return report.getPageSize();
	}

	public int getPageLine() {
		return report.getPageLine();
	}

	public void saltaLinhas(int qtdLinhas) throws ParseException, JRException {
		report.saltaLinhas(qtdLinhas);
	}

	public void gravaRelatorio(int nroRel) throws ParseException, JRException {
		report.gravaRelatorio(report, nroRel, false);
	}

	public void imprimir() throws FileNotFoundException, JRException {
		report.imprimir();
	}

	public String getDiaideNomide() {
		return diaideNomide;
	}

	public void setDiaideNomide(String diaideNomide) throws ParseException {
		this.diaideNomide = diaideNomide;
		report.adicionaValorReport("diaideNomide", diaideNomide);
	}

	public Long getDinideRegger() {
		return dinideRegger;
	}

	public void setDinideRegger(Long dinideRegger) throws ParseException {
		this.dinideRegger = dinideRegger;
		report.adicionaValorReport("dinideRegger", dinideRegger);
	}

	public String getHoraCorrente() {
		return horaCorrente;
	}

	public void setHoraCorrente(String horaCorrente) throws ParseException {
		this.horaCorrente = horaCorrente;
		report.adicionaValorReport("horaCorrente", horaCorrente);
	}

}
